/**
 * User: Amitav Roy
 * Date: 10/27/12
 * Time: 2:23 PM
 */

function dashboard_home($scope, $http) {
	$scope.name = base_url;
	$scope.last_ten_trans = '';

	// Getting the last 10 transactions in JSON format.
	$http({
		url: base_url + '/dashboard/json_last_ten_trans',
		method: "POST",
//		data: {"foo":"bar"}
	}).success(function(data) {
		$scope.last_ten_trans = data;
	});
}

function bill_payment($scope, $http) {
	$scope.total_amount = 0;
	
	$http({
		url: base_url + '/dashboard/bills_payments_this_month',
		method: "POST",
	}).success(function(data) {
		
		for (var i = 0; i < data.length; i++) {
			$scope.total_amount = $scope.total_amount + parseFloat(data[i].amount);
		}
		
		$scope.bill_payments = data;
		
//		console.log(data.length);
	});
}